package com.leo.foodmaster.admin.customer.service.impl;

import org.springframework.stereotype.Service;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.leo.foodmaster.admin.customer.dto.CustomerDeliveryTypeDTO;
import com.leo.foodmaster.admin.customer.entity.CustomerDeliveryTypeEntity;
import com.leo.foodmaster.admin.customer.mapper.CustomerDeliveryTypeMapper;
import com.leo.foodmaster.admin.customer.service.ICustomerDeliveryTypeService;
import lombok.AllArgsConstructor;

/**
 * 客户配送方式
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2021-11-20
 */
@Service
@AllArgsConstructor
public class ICustomerDeliveryTypeServiceImpl extends ServiceImpl<CustomerDeliveryTypeMapper, CustomerDeliveryTypeEntity> implements ICustomerDeliveryTypeService {

	private final CustomerDeliveryTypeMapper customerDeliveryTypeMapper;
	@Override
	public IPage<CustomerDeliveryTypeEntity> page(IPage<CustomerDeliveryTypeDTO> page, CustomerDeliveryTypeDTO customerDeliveryTypedto) {
			CustomerDeliveryTypeEntity customerDeliveryTypeentity=new CustomerDeliveryTypeEntity();
		BeanUtil.copyProperties(customerDeliveryTypedto,customerDeliveryTypeentity);
		LambdaQueryWrapper<CustomerDeliveryTypeEntity> eq = Wrappers.lambdaQuery(customerDeliveryTypeentity);
		return customerDeliveryTypeMapper.selectPage(new Page<>(page.getCurrent(),page.getSize()), eq);
	}

	@Override
	public IPage<CustomerDeliveryTypeDTO> pageList(IPage<CustomerDeliveryTypeDTO> page,CustomerDeliveryTypeDTO customerDeliveryTypeDTO) {

		return customerDeliveryTypeMapper.pageList(page,customerDeliveryTypeDTO);
	}}
